<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>发布课程</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 20px;
        }
        .navbar {
            background-color: #333;
            overflow: hidden;
            padding: 10px 20px;
        }
        .navbar a {
            float: left;
            display: block;
            color: white;
            text-align: center;
            padding: 14px 20px;
            text-decoration: none;
        }
        .navbar a:hover {
            background-color: #ddd;
            color: black;
        }
        .container {
            background-color: #fff;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            max-width: 600px;
            margin: 20px auto;
        }
        h2 {
            color: #333;
            text-align: center;
            margin-bottom: 25px;
        }
        .form-group {
            margin-bottom: 15px;
        }
        .form-group label {
            display: block;
            margin-bottom: 8px;
            color: #555;
            font-weight: bold;
        }
        .form-group input[type="text"],
        .form-group textarea,
        .form-group input[type="number"] {
            width: calc(100% - 22px);
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 16px;
        }
        .btn-submit {
            background-color: #28a745;
            color: white;
            padding: 12px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 18px;
            width: 100%;
            transition: background-color 0.3s ease;
            margin-top: 20px;
        }
        .btn-submit:hover {
            background-color: #218838;
        }
        .message {
            margin-top: 15px;
            padding: 10px;
            border-radius: 4px;
            font-size: 14px;
            text-align: center;
        }
        .error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
        .success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
    </style>
</head>
<body>
    <div class="navbar">
        <a href="${pageContext.request.contextPath}/laoshi_index.jsp">首页</a>
        <a href="${pageContext.request.contextPath}/laoshi_publish_course.jsp">发布课程</a>
        <a href="${pageContext.request.contextPath}/laoshi_my_courses">我的课程</a>
        <a href="${pageContext.request.contextPath}/laoshi_personal_center.jsp">个人中心</a>
        <a href="${pageContext.request.contextPath}/logout">退出登录</a>
    </div>
    <div class="container">
        <h2>发布新课程</h2>
        <form action="laoshi_publish_course" method="post">
            <div class="form-group">
                <label for="courseName">课程名称:</label>
                <input type="text" id="courseName" name="courseName" required>
            </div>
            <div class="form-group">
                <label for="courseDescription">课程描述:</label>
                <textarea id="courseDescription" name="courseDescription" rows="5"></textarea>
            </div>
            <div class="form-group">
                <label for="maxCapacity">最大容量:</label>
                <input type="number" id="maxCapacity" name="maxCapacity" required min="1">
            </div>
            <button type="submit" class="btn-submit">发布课程</button>
        </form>

        <c:if test="${not empty errorMessage}">
            <p class="message error"><c:out value="${errorMessage}"/></p>
        </c:if>
        <c:if test="${not empty successMessage}">
            <p class="message success"><c:out value="${successMessage}"/></p>
            <script>
                setTimeout(function() {
                    window.location.href = '${pageContext.request.contextPath}/laoshi_index.jsp';
                }, 3000);
            </script>
        </c:if>
    </div>
</body>
</html> 